//	ID : pallab81
// 	PROG : 166
// 	LANG : C++
// 	2011-07-22-15.34.00 Friday
//
// 	"I have not failed, I have just found 10000 ways that won't work.
//


#include <iostream>
#include <algorithm>
#include <vector>
#include <sstream>
#include <fstream>
#include <string>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <functional>
#include <bitset>

#include <cassert>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <climits>
#include <cstring>

using namespace std;

#define fo(i,ed) for(int i = 0 ; i < ed ; ++i )
#define foit(i, x) for (typeof((x).begin()) i = (x).begin(); i != (x).end(); i++)
#define bip system("pause")
#define Int long long
#define pb push_back
#define SZ(X) (int)(X).size()
#define LN(X) (int)(X).length()
#define mk make_pair
#define f first
#define s second
#define SET( ARRAY , VALUE ) memset( ARRAY , VALUE , sizeof(ARRAY) )


int w[6]= {5,10,20, 50,100,200};
int coin[6];
int money;

inline int yeo(int var){
    int i=5;
    int d=0;
    while( var>0 && i>=0 ){
        if( var>=w[i] ){
            var-=w[i];
            ++d;
        }
        else{
            --i;
        }
    }
    if(var)return -1;
return d;
}
inline bool read() {
    bool allzero=true;
    fo(i,6) {
        cin>>coin[i];
        if(coin[i]!=0) {
            allzero=false;
        }
    }
    if(allzero==true)return false;
    float ditehobe;
    cin>>ditehobe;

    money = (int)(ditehobe*100. + 0.5);

    return true;
}
vector< int > dp;
inline void fill(int val) {
    for(int i=5000; i>=0; --i) {
        if( dp[i]!=-1 ) {
            if(dp[i+val]==-1) {
                dp[i+val] = dp[i]+1;
            } else {
                dp[i+val] = min(dp[i+val], dp[i]+1);
            }
        }
    }
}
inline void proc() {
    dp.assign( 5010, -1 );
    dp[0]=0;
    for(int i=0; i<6; ++i) {
        int weight = w[i];
        int have = coin[i];

        while(have) {
            fill(weight);
            --have;
        }

    }
    int mx = 5000;
    int best = (int)1023456789;
    while(mx>=money){
        int give = mx;
        int pay_back = mx-money;

        if( dp[give]!=-1){
            if(dp[pay_back]!=-1){
                best = min( best, dp[give]+dp[pay_back]);
            }
            int another = yeo(pay_back);
            if(another!=-1){
                best = min(best, dp[give]+another);
            }
        }

        --mx;
    }
    printf("%3d\n",best);
}

int main() {
    #ifndef ONLINE_JUDGE
        freopen("in.c","rt",stdin);
    #endif
    while(read()) {
        proc();
    }

    return 0;
}


